package com.usian.admin.controller;

import com.usian.admin.service.TbAdminService;
import com.usian.apis.admin.TbAdminControllerApi;
import com.usian.model.admin.dtos.TbAdminDto;
import com.usian.model.admin.pojos.TbAdmin;
import com.usian.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/tbadmin")
@Api(tags = "2.5周末作业")
public class TbAdminController implements TbAdminControllerApi {

    @Autowired
    private TbAdminService tbAdminService;


    @GetMapping
    @ApiOperation(value = "多条件查询",notes = "根据用户名称状态查询列表")
    @Override
    public ResponseResult select(TbAdminDto tbAdmin) {
        return tbAdminService.select(tbAdmin);
    }

    @GetMapping("/uptone")
    @ApiOperation(value = "状态更新",notes = "更新状态为禁用")
    @Override
    public ResponseResult uptone(TbAdmin tbAdmin) {
        return tbAdminService.uptone(tbAdmin);
    }

    @GetMapping("/upttwo")
    @ApiOperation(value = "状态更新",notes = "更新状态为启用")
    @Override
    public ResponseResult upttwo(TbAdmin tbAdmin) {
        return tbAdminService.upttwo(tbAdmin);
    }



    @PostMapping("/save")
    @ApiOperation(value = "修改真实姓名",notes = "根据表单修改真实姓名")
    @Override
    public ResponseResult ist(@RequestBody TbAdmin tbAdmin) {
        return tbAdminService.ist(tbAdmin);
    }
}
